Skip to content

Add document system and improve graph visualization#2

Closed
avrabe wants to merge 7 commits into
mainfrom
feat/documents-graph-ui
Closed

Add document system and improve graph visualization#2
avrabe wants to merge 7 commits into
mainfrom
feat/documents-graph-ui

Conversation

@avrabe
Copy link
Copy Markdown
Contributor

@avrabe avrabe commented Mar 8, 2026

Summary

  • Document system: Markdown files with YAML frontmatter and [[ID]] wiki-link artifact references. Includes parser, validation, section hierarchy extraction, and dashboard routes (/documents, /documents/{id}) with rendered body, table of contents, glossary, and referenced artifacts table.
  • Graph improvements: Full-viewport container with zoom controls, clickable nodes, touch support, edge label pills, color legend, focus autocomplete, better node sizing.
  • Example: docs/srs.md — System Requirements Specification referencing all 16 REQ artifacts.

Test plan

  • 75 tests passing (9 new document tests)
  • cargo validate reports 1 document with 16 references, 0 broken
  • clippy clean, fmt clean
  • Manual: verify /documents list, /documents/SRS-001 rendered view
  • Manual: verify graph zoom/pan/click on desktop and touch devices

🤖 Generated with Claude Code

Documents:
- Markdown with YAML frontmatter and [[ID]] wiki-link references
- Document model, parser, reference extraction, section hierarchy
- DocumentStore, validate_documents() for broken ref detection
- /documents and /documents/{id} serve routes with rendered body,
  table of contents, glossary, and referenced artifacts table
- Example SRS document (docs/srs.md) with 16 artifact references
- rivet.yaml `docs:` config field

Graph improvements:
- Full-viewport graph container with zoom controls (+/-/fit)
- Clickable nodes navigating to artifact detail via HTMX
- Touch support (pinch zoom, drag pan)
- Edge labels with background pills for readability
- Color legend showing present artifact types
- Focus autocomplete with datalist
- Wider nodes (200px) and better spacing

75 tests passing.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 8, 2026

Codecov Report

❌ Patch coverage is 69.65085% with 339 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
rivet-core/src/document.rs 50.33% 298 Missing ⚠️
rivet-core/src/results.rs 92.92% 21 Missing ⚠️
rivet-core/src/validate.rs 0.00% 17 Missing ⚠️
rivet-core/src/coverage.rs 98.52% 3 Missing ⚠️

📢 Thoughts on this report? Let us know!

avrabe and others added 6 commits March 8, 2026 13:20
- Atkinson Hyperlegible for body text, JetBrains Mono for IDs/code
- CSS custom properties design system (colors, spacing, shadows)
- Dark sidebar (#0f0f13) with active nav state tracking
- HTMX loading bar animation and content swap transitions
- Refined tables (alternating rows, hover), cards (subtle shadows),
  badges (consistent palette), form controls (focus rings, styled selects)
- Stat boxes with hover lift, scrollbar styling, selection color
- Keyboard navigation focus-visible outlines throughout

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…lossary

The document body had a duplicate glossary as a markdown table that wasn't
being parsed. Added table rendering (header, separator, body rows) to the
lightweight markdown renderer and replaced the body table with a reference
to the frontmatter glossary panel.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
… polish

- Coverage: rivet-core/src/coverage.rs module with compute_coverage(), CLI
  `rivet coverage` command (table/json output, --fail-under), /coverage
  dashboard route with progress bars and uncovered artifact lists
- Init: `rivet init` command creates rivet.yaml + artifacts/ + docs/ scaffold
  with --name, --schema, --dir options
- Search: Cmd+K command palette with debounced search across artifacts and
  documents, arrow key navigation, highlighted matches, grouped results
- ASPICE example: examples/aspice/ with full V-model braking system
  (STKH->SYSREQ->SWREQ->SWARCH->SWDD->UVER->SWINTVER->SWVER->SYSINTVER->SYSVER)
- UI: Atkinson Hyperlegible font, dark sidebar, loading bar, content
  transitions, refined tables/badges/forms, command palette styling

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Stat boxes have colored top borders (blue/green/orange/red/amber/purple)
  matching their semantic meaning, with matching number colors
- Nav sidebar shows artifact count, error badge (red if >0), and doc count
- Nav divider separates primary views from analysis tools
- Artifact detail uses styled primary/secondary action buttons
- Footer shows "Powered by Rivet v{version}" from CARGO_PKG_VERSION
- CSS classes: stat-{color}, nav-badge, nav-badge-error, nav-divider,
  nav-label, btn, btn-primary, btn-secondary, detail-actions, footer

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Replace HTML entity icons with clean 16x16 inline SVG icons (Lucide-style
  stroke icons for Overview, Artifacts, Validation, Matrix, Coverage, Graph,
  Documents, Search)
- Per-type colored badges: badge_for_type() computes rgba(r,g,b,.12)
  background from type_color_map() hex colors, applied across all views
- Artifact list client-side search filter with inline SVG search icon
- Overview status distribution with horizontal progress bars showing
  approved/draft/unknown ratios
- Validation summary bar: green gradient for pass, red gradient for fail
- Sidebar active state with left blue accent border
- h2 headings with bottom border for visual separation
- Better heading hierarchy throughout

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…g, project selector

- rivet-core: add results module (TestStatus, TestRun, ResultStore, load_results)
- rivet-core: add results field to ProjectConfig for test run YAML directory
- rivet-core: enhance markdown renderer with code blocks, ordered lists,
  blockquotes, inline code, and markdown links
- rivet-cli: add verification dashboard (/verification) showing req→verifier
  mapping with test steps, method badges, and latest result dots
- rivet-cli: add results dashboard (/results, /results/{run_id}) with run
  history, pass rate stats, and per-artifact result tables
- rivet-cli: add project overview with coverage summary, test results, and
  quick links on the landing page
- rivet-cli: add project selector with sibling discovery (examples/ and peers)
  shown as a dropdown in the context bar
- rivet-cli: add load_project_full() for serve command to load docs + results
- examples/aspice: add test result YAML files (run-001, run-002)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@avrabe
Copy link
Copy Markdown
Contributor Author

avrabe commented Mar 8, 2026

Superseded by a new PR from feat/aadl-integration which includes all these changes plus live reload, source viewer, git diff, STPA dashboard, dogfood docs, and test mapping.

@avrabe avrabe closed this Mar 8, 2026
@avrabe avrabe deleted the feat/documents-graph-ui branch March 19, 2026 07:02
avrabe added a commit that referenced this pull request May 15, 2026
Three flake classes hitting every PR today, all on self-hosted runners:

1. Verus + Rocq Proofs: "sudo: 'no new privileges' flag is set"
2. Mutation Testing (rivet-cli): "No space left on device"
3. Supply Chain (cargo-vet): "runner has received a shutdown signal"

All three block green CI on PRs that have nothing to do with the
underlying subsystem. Each fix is workflow-level so it lands without
runner-host changes.

**1) Verus + Rocq: switch Nix installer.**
The self-hosted runners run with systemd `NoNewPrivileges=true`, which
breaks `cachix/install-nix-action@v31` because it shells out to sudo
mid-install. Switch to `DeterminateSystems/nix-installer-action@main`
with `init: none` (daemonless single-user mode). Add a follow-up step
to put `~/.nix-profile/bin` on PATH explicitly. Cost: ~30s install,
comparable speed once cached. Keeps the lean-mem requirement intact —
the Verus solver still wants the RAM.

**2) Mutation Testing: prune + restrict upload.**
cargo-mutants writes a per-mutant target directory under `mutants-out/`.
Seventeen shards landing on the same pool, with the Swatinem cache hot,
leave 5-15 GB behind each. The next shard's `Upload mutants report`
step dies with ENOSPC during the upload itself — after cargo-mutants
has finished cleanly. Two changes:
  - Add a `Prune stale mutants artefacts` step before the run (rm
    mutants-out, find + rm matching target subdirs older than a day).
  - Restrict `upload-artifact` path to the text/JSON reports only —
    skip the per-mutant target directories that drive the bloat. The
    text reports are what matter for triage.

**3) cargo-vet: wrap in retry.**
GitHub Actions doesn't expose "runner restarted under me" to `if:`
conditions, but `nick-fields/retry@v3` with `retry_on: error` handles
it correctly — if the runner agent dies mid-step the step exits
non-zero, the action retries on a different runner. Two attempts is
enough; a third shutdown in ten minutes would point at runner-pool
sizing, not at this job. Same pattern fits other light jobs (`fmt`,
`yaml-lint`, `msrv`, `docs-check`) but those aren't currently flaking,
so leave them alone — speculative retry on stable jobs hides real
bugs.

Cross-cutting note for runner-ops: the underlying fixes for these are
host-level too — drop `NoNewPrivileges` from the runner systemd unit
(fixes #1), lower the `post-job.sh` disk threshold from 70% to ~50%
(helps #2), grow the lean-mem pool size (helps #3). The workflow-level
changes here unblock CI today; the host-level work is the durable fix
and worth a separate Ansible PR.
avrabe added a commit that referenced this pull request May 18, 2026
…link (#302)

User-reported regressions against `rivet import-results --format junit`:

**Bug #1: silent overwrite on re-import.** `suite_to_run` built
`run_id = format!("junit-{safe_name}")` from the testsuite name only,
so two CI runs of the same suite produced identical filenames and the
second import wiped the first.

Fix: append a disambiguator to the run_id. When the JUnit
`<testsuite timestamp="...">` attribute is present (most CI tooling
emits it), slugify it: `2026-05-17T06-35-44Z`. When absent, hash the
suite's case list (name, classname, outcome variant) and append as
16-hex DefaultHasher digest. Identical re-imports of the same artefact
remain idempotent (same hash → same filename → no churn); different
content distinguishes itself.

**Bug #2: test→artifact link dropped on cargo-nextest output.**
`artifact_id_for` has 4 heuristics; the fallback emits a literal
`"classname.name"` concatenation that the test-coverage report cannot
join back to any artifact. cargo-nextest doesn't bracket
`[REQ-NNN]` or use the artifact ID as classname, so most rivet-on-rust
projects hit the fallback.

Fix: hook the JUnit importer into `test_scanner`. New public
`parse_junit_xml_with_markers(xml, markers)` adds a 5th heuristic —
when the existing fallback fires, look up a marker whose `test_name`
matches the case name (exact or suffix with separator). The CLI
(`cmd_import_results_junit`) scans the project's `src/`+`tests/` for
`// rivet: verifies REQ-NNN` markers before parsing the XML, then
passes them to the new function. Bracketed and direct-classname IDs
are preserved (they short-circuit before the marker lookup).

Existing `parse_junit_xml` kept working unchanged (delegates to the
new path with an empty marker slice). No schema changes.

Tests added (6):
- run_id_includes_timestamp_when_present
- run_id_stable_hash_when_no_timestamp
- run_id_different_hash_when_content_differs
- marker_lookup_supplies_artifact_id_when_fallback_concat
- marker_lookup_does_not_override_explicit_bracket
- marker_lookup_returns_fallback_when_no_match

Workspace: 1003 lib tests pass (was 996, +7). Clippy clean. Format clean.

Trace: skip

Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant